<template>

   <div class="after-sale-reason views-container">

       <div class="wlm-table">
          <div class="wlm-table-header">
        <!--  -->
            <el-form :model="tableFormatData.ListAll.files" size="small" label-width="80px" class="retail-form" label-position="right">
                <el-form-item label="" class="filter">
                    <el-form-item label="搜索内容：" class="search">

                        <el-input @keyup.enter.native="filesSerch" v-model="tableFormatData.ListAll.files.name" placeholder="请输入门店名称、商家名称" style="width:220px;margin-right:20px;"></el-input>
                    </el-form-item>
                      <el-form-item label="是否展示到好店：" class="search">
                        <el-select v-model="tableFormatData.ListAll.files.is_display" placeholder="请选择" style="margin-left:30px;">
                            <el-option v-for="item in [{lable:'是',value:'1'},{lable:'否',value:'2'}]" :key="item.value" :label="item.lable" :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form-item>
                <el-form-item label="" class="filter-btns">
                    <el-button type="primary" @click="filesSerch">筛选</el-button>
                    <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
                </el-form-item>
            </el-form>

        </div>
             <div class="wlm-table-content">
                 <el-table
:ref="tableFormatData.ListAll.key"
:data="tableFormatData.ListAll.tableData"
          style="width:100%"

        >
          <el-table-column prop="sort" width="80" label="排序" sortable>
                    <template slot-scope="scope">
                      <!-- @blur="changeTableItem({id:scope.row.id,sort:scope.row.sort},tableFormatData.userTable.change.sort)" -->
                        <el-input-number  style="width:100%;" @blur="changeTableItem({id:scope.row.id,sort:scope.row.sort},tableFormatData.ListAll.change.sort)" size="mini" v-model="scope.row.sort" :controls="false"></el-input-number>
                    </template>
                </el-table-column>
                 <el-table-column
            prop=""
            label="门店"
          >
            <template slot-scope="scope">
                <span>{{scope.row.name}}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="avatarUrl"
            label="商家"
          >
            <template slot-scope="scope">
                <span>{{scope.row.business_name}}</span>
            </template>
          </el-table-column>

          <el-table-column
            prop=""
            label="是否展示到V2样式好店"
          >
            <template slot-scope="scope">
                        <el-switch :active-value="1" :inactive-value="2" @change="changeTableItem({id:scope.row.id,is_display:scope.row.is_display},tableFormatData.ListAll.change.sort)" v-model="scope.row.is_display"> </el-switch>
            </template>
          </el-table-column>
            <el-table-column
            prop=""
            label="操作"
            width="200"
          >
          <template slot-scope="scope">
            <!--  -->
               <router-link class="wlm-text" tag="a" target="_blank" :to="{path:'/merchant/storeListMerchantAdd', query :{ 
                 id:scope.row.id,
                 store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                  h_aid:$route.query.h_aid?$route.query.h_aid:'',}}">
              <el-button class="wlm-text" type="text">编辑</el-button>
               </router-link>
          </template>
            </el-table-column>
        </el-table>
             </div>
             <div class="pagination-content flex-row flex-justify-e flex-align-c">
          <el-pagination
            :disabled="!hasTableData"
            @size-change="listPageChange"
            @current-change="listPageChange"
            :current-page.sync="tableFormatData.ListAll.pagination.page"
            :page-sizes="tableFormatData.ListAll.pagination.pagesizes"
            :page-size.sync="tableFormatData.ListAll.pagination.list_rows"
            layout="total, sizes, prev, pager, next, jumper"
            :total="hasTableData?tableFormatData.ListAll.pagination.total : 0"
          >
          </el-pagination>
        </div>
       </div>

   </div>
</template>
<script>
import { storeListAll, upStore } from '@/api/merchant'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'ListAll',
  data() {
    return {
      tableFormatData: {
        current: 'ListAll',
        ListAll: {
          key: 'ListAll',
          api: {
            getList: storeListAll
          },
          tableData: [],
          files: {
            name: '',
            ids: [],
            checkall: '0',
            live_state: 'all',
            sort_name: '',
            sort_id: '',
            is_display: ''
          },
          change: {
            sort: {
              name: '排序',
              key: 'sort',
              api: upStore
            }
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
    }
  }
}
</script>
<style lang="scss" scoped>

</style>
